<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        window.onload =function () {
            var btn =document.getElementById('btn');
            btn.onclick = function () {
                alert('乱点什么呢！')

            }
        }

    </script>
</head>
<body>
<button id="btn">这是一个按钮</button>
</body>
</html>